package org.ahuanlien.crm.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

@Getter@Setter
public class SalesChartQueryObject {

    private Long productId;
    private Long companyId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="gmt+8")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="gmt+8")
    private Date endTime;
    private String groupType="employee.realname";
    
    public static Map<String, Object> groupBys = new LinkedHashMap<>();
    static {
        groupBys.put("company.name", "保险机构");
        groupBys.put("employee.realname", "业务人员");
        groupBys.put("DATE_FORMAT(record.pDate,'%y-%m')", "销售日期(月)");
        groupBys.put("DATE_FORMAT(record.pDate,'%y-%m-%d", "销售日期(日)");
    }
}
